package com.yixun.qfbao.hander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.FileAttachmentService;
import com.yixun.qfbao.apidto.GetLogoReqDto;
import com.yixun.qfbao.apidto.GetLogoResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetLogoReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * 获取Logo
 * 
 * @author Administrator
 *		
 */
@Service("getLogoHander")
public class GetLogoHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(GetLogoHander.class);
	
	@Autowired
	private FileAttachmentService fileAttachmentService;
	
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		GetLogoReqVo req = (GetLogoReqVo)reqDto;
		GetLogoReqDto reqDto1 = req.getParams();
		BaseResponseDTO<GetLogoResDto> res = new BaseResponseDTO<>();
		GetLogoResDto resDto = new GetLogoResDto();
		try {
			resDto = fileAttachmentService.getLogo(reqDto1);
			res.setResData(resDto);
			res.setResult(resDto.getResult());
		} catch (Exception e) {
			logger.error("GetLogoHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("Logo获取失败!");
		}
		return res;
	}
	
}
